/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.gerenciadorfinanceiro.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author eduardo
 */
@Entity
@Table(name = "outcome", catalog = "gf_desenv", schema = "")
@NamedQueries({@NamedQuery(name = "Outcome.findAll", query = "SELECT o FROM Outcome o"), @NamedQuery(name = "Outcome.findById", query = "SELECT o FROM Outcome o WHERE o.id = :id"), @NamedQuery(name = "Outcome.findByDescriptionOutcome", query = "SELECT o FROM Outcome o WHERE o.descriptionOutcome = :descriptionOutcome"), @NamedQuery(name = "Outcome.findByValue", query = "SELECT o FROM Outcome o WHERE o.value = :value"), @NamedQuery(name = "Outcome.findByData", query = "SELECT o FROM Outcome o WHERE o.data = :data"), @NamedQuery(name = "Outcome.findByExpirationData", query = "SELECT o FROM Outcome o WHERE o.expirationData = :expirationData")})
public class Outcome implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "descriptionOutcome")
    private String descriptionOutcome;
    @Basic(optional = false)
    @Column(name = "value")
    private double value;
    @Basic(optional = false)
    @Column(name = "data")
    @Temporal(TemporalType.DATE)
    private Date data;
    @Basic(optional = false)
    @Column(name = "expirationData")
    @Temporal(TemporalType.DATE)
    private Date expirationData;
    @JoinColumn(name = "owner", referencedColumnName = "id_user")
    @ManyToOne(optional = false)
    private User owner;
    @JoinColumn(name = "source", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private OutcomeSource source;

    public Outcome() {
    }

    public Outcome(Integer id) {
        this.id = id;
    }

    public Outcome(Integer id, String descriptionOutcome, double value, Date data, Date expirationData) {
        this.id = id;
        this.descriptionOutcome = descriptionOutcome;
        this.value = value;
        this.data = data;
        this.expirationData = expirationData;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDescriptionOutcome() {
        return descriptionOutcome;
    }

    public void setDescriptionOutcome(String descriptionOutcome) {
        this.descriptionOutcome = descriptionOutcome;
    }

    public double getValue() {
        return value;
    }

    public void setValue(double value) {
        this.value = value;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public Date getExpirationData() {
        return expirationData;
    }

    public void setExpirationData(Date expirationData) {
        this.expirationData = expirationData;
    }

    public User getOwner() {
        return owner;
    }

    public void setOwner(User owner) {
        this.owner = owner;
    }

    public OutcomeSource getSource() {
        return source;
    }

    public void setSource(OutcomeSource source) {
        this.source = source;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Outcome)) {
            return false;
        }
        Outcome other = (Outcome) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.gerenciadorfinanceiro.ejb.entity.Outcome[id=" + id + "]";
    }

}
